package com.eastfair.builder.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展商
 * </p>
 *
 * @author dqq
 * @date 2023-05-15
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitorEarnestMoneyPayStatusEnum", description = "保证金缴纳状态 #{NOT_PAY:未支付;PARTPAY:部分支付;HAS_PAY:已支付;NOT_NEED_PAY:无需缴纳-枚举")
public enum ExhibitorEarnestMoneyPayStatusEnum implements BaseEnum {

    /**
     * NOT_PAY="未支付"
     */
    NOT_PAY("未支付"),
    /**
     * PARTPAY="部分支付"
     */
    PARTPAY("部分支付"),
    /**
     * HAS_PAY="已支付"
     */
    HAS_PAY("已支付"),
    /**
     * NOT_NEED_PAY="无需缴纳"
     */
    NOT_NEED_PAY("无需缴纳"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitorEarnestMoneyPayStatusEnum match(String val, ExhibitorEarnestMoneyPayStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitorEarnestMoneyPayStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitorEarnestMoneyPayStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_PAY,PARTPAY,HAS_PAY,NOT_NEED_PAY", example = "NOT_PAY")
    public String getCode() {
        return this.name();
    }

}
